<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 相同的函数会放到，prototype中这是为了节省内存空间。
        //constructor 记录了创建对象是由哪个构造函数创建的 ，
        function Person(name, age) {
            this.name = name
            this.age = age
        }
        var that
        Person.prototype = {
            construtor: Person,
            sing: function() {
                console.log("在唱歌")
                that = this
            }
        }
        let ldh = new Person('刘德华', 19)
        console.log(ldh.__proto__.constructor)
        console.log(Person.prototype === ldh.__proto__)
        console.log(ldh.sing());
        console.log(ldh === that);
    </script>
</body>

</html>